//
//  showMoreViewController.m
//  one_mile_01
//
//  Created by 王进帅 on 15/9/6.
//  Copyright (c) 2015年 王雅蓉. All rights reserved.
//

#import "showMoreViewController.h"

@interface showMoreViewController ()

@end

@implementation showMoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIView *navigationV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, NAVIGATIONHEIGHT)];
    navigationV.backgroundColor = BACKGROUND_MAIN_COLOR;
    [self.view addSubview:navigationV];
    
    //    返回按钮
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button.frame = POP_FRAME;
    [self.button setBackgroundImage:[UIImage imageNamed:@"pop_light@2x.png"] forState:UIControlStateNormal];
    self.button.backgroundColor = [UIColor clearColor];
    [self.button addTarget:self action:@selector(backButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.button];
    
    UILabel *titleL =  [[UILabel alloc]initWithFrame:NAVIGATION_TITLE_FRAME];
    titleL.text = @"详情介绍";
    titleL.font = NAVIGATION_TITLE_FONT;
    titleL.textAlignment = NSTextAlignmentCenter;
    titleL.textColor = [UIColor whiteColor];
    [self.view addSubview:titleL];
        
    self.webV = [[UIWebView alloc]initWithFrame:CGRectMake(10, NAVIGATIONHEIGHT + 5, WIDTH - 20, HEIGHT - NAVIGATIONHEIGHT - 5)];
    self.webV.scrollView.backgroundColor = [UIColor clearColor];
    self.webV.backgroundColor = [UIColor clearColor];
    self.webV.delegate = self;
    //取消webView的滑动条
    self.webV.dataDetectorTypes = UIDataDetectorTypeLink;
    
    for (UIView *_aView in [self.webV subviews])
    {
        if ([_aView isKindOfClass:[UIScrollView class]])
        {
            [(UIScrollView *)_aView setShowsVerticalScrollIndicator:NO];
            //右侧的滚动条
        }
    }
    
    NSString *jsString = [NSString stringWithFormat:@"<html> \n"
                          "<head> \n"
                          "<link href=\"personal.css\" rel=\"stylesheet\" type=\"text/css\"> \n"
                          "</style> \n"
                          "</head> \n"
                          "<br><body>%@</body> \n"
                          "</html>", self.contentLabel.text];
    
    NSString *path = [[NSBundle mainBundle] bundlePath];
    NSURL *baseURL = [NSURL fileURLWithPath:path];  
    [self.webV loadHTMLString:jsString baseURL:baseURL];
    
    [self.view addSubview: self.webV];
}

-(void)backButton:(UIButton *)button{

    [self.navigationController popViewControllerAnimated:YES];
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.alpha = 0;
//    [self.navigationController setNavigationBarHidden:YES animated:NO];
}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.navigationController.navigationBar.alpha = 1;
//    [self.navigationController setNavigationBarHidden:NO animated:NO];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
